package api_.string_;


public class StringBuilderDemo
{
    public static void main(String[] args)
    {
        // StringBuilder 是可以修改的String
        StringBuilder stringBuilder1 = new StringBuilder("123");

        // String StringBuffer 相互转换
        StringBuilder builder = new StringBuilder(" a");
        for (int i = 0 ; i < 10000000 ; i++)
        {
            builder.append("a");
        }
        System.out.println("append over");

        String s = builder.toString();
        builder = new StringBuilder(s);

        StringBuilder learnGole = new StringBuilder("good good study");
        learnGole.append(",day day up");
        System.out.println(learnGole);
        // [start,end) 做闭右开
        learnGole.replace(0,16,"好好学习,");
        System.out.println(learnGole);

        learnGole.delete(0,4);
        System.out.println(learnGole);
        // 在位置0之前插入alive，也就是在,之前插入
        learnGole.insert(0,"alive");
        System.out.println(learnGole);





    }
}
